from rich.console import Console
console = Console()
try:
    do_something()
except:
    console.print_exception()